<template>
  <div class="loading">
    <div class="loading-inner">
      <div class="icon">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
      </div>
      <div class="title">{{ title }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Loading',
  props: {
    title: {
      type: String,
      default: '加载中'
    }
  }
}
</script>

<style lang="scss" scoped>
.loading {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  // background-color: rgba(255, 255, 255, 0.5);
  .loading-inner {
    .icon {
      width: 34px;
      animation: rotate 2.5s linear infinite;
      span {
        display: inline-block;
        vertical-align: top;
        width: 15px;
        height: 15px;
        margin: 1px;
        background-color: $color-button-little;
      }
      span:nth-child(1) {
        border-radius: 50% 50% 0 50%;
      }
      span:nth-child(2) {
        border-radius: 50% 50% 50% 0;
      }
      span:nth-child(3) {
        border-radius: 50% 0 50% 50%;
      }
      span:nth-child(4) {
        border-radius: 0 50% 50% 50%;
      }
    }
    .title {
      text-align: center;
      margin-top: 15px;
      font-size: $font-size-small;
      color: $color-text-blue;
    }
  }

  @keyframes rotate {
    0% {
      transform: rotate(0);
    }

    100% {
      transform: rotate(360deg);
    }
  }
}
</style>
